(uniscribe_encode_char): Return FONT_INVALID_CHAR
authorJason Rumney <jasonr@gnu.org>
Sun, 21 Dec 2008 15:51:29 +0000 (15:51 +0000)
committerJason Rumney <jasonr@gnu.org>
Sun, 21 Dec 2008 15:51:29 +0000 (15:51 +0000)
when character maps to .notdef character.

src/w32uniscribe.c

index 14ce7449a09fa0f380714de77139ba0d2f1b668c..1b5984fbea6a180bb8fcd1fdcebbe339f8d3c442 100644 (file)
@@ -516,7 +516,10 @@ uniscribe_encode_char (font, c)
 
           if (SUCCEEDED (result) && nglyphs == 1)
             {
-              code = glyphs[0];
+             /* Some fonts return .notdef glyphs instead of failing.
+                (Truetype spec reserves glyph code 0 for .notdef)  */
+             if (glyphs[0])
+               code = glyphs[0];
             }
           else if (SUCCEEDED (result) || result == E_OUTOFMEMORY)
             {
@@ -526,11 +529,8 @@ uniscribe_encode_char (font, c)
                  later.  */
               result = ScriptGetCMap (context, &(uniscribe_font->cache),
                                       ch, len, 0, glyphs);
-              if (SUCCEEDED (result))
+              if (SUCCEEDED (result) && glyphs[0])
                 code = glyphs[0];
-              else
-                code = 0; /* notdef - enough in some cases to get the script
-                             engine working, but not others... */
             }
        }
     }